<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
</head>
<body>
<button>get</button>
<button>post</button>
<button>axios</button>
<script>
    document.querySelectorAll('button')[0].addEventListener('click',function (){
        axios.defaults.baseURL = 'http://127.0.0.1:8000'

        axios.get('/axios',{
            params:{
                axiosMethod:'get',
            },
            headers:{
                name:'axiosGet'
            }
        },{
            params:{
                aa:1
            }
        })
    })
    document.querySelectorAll('button')[1].addEventListener('click', function () {
        axios.defaults.baseURL = 'http://127.0.0.1:8000'
        axios.post('/axios', {
            age: 1
        }, {
            params: {
                sex: 1
            },
            headers: {
                like: 'game'
            }
        }).then(value => {
            console.log(value)
        })
    })
    document.querySelectorAll('button')[2].addEventListener('click',function (){
        axios({
            url: 'http://127.0.0.1:8000/axios',
            method: 'post',
            params:{
                name: 'axiosAjax'
            },
            data:{
                aa: 11
            }
        }).then(value => {
            console.log(value)
        })
    })

</script>
</body>
</html>